package com.ms.demo;

/**
 * @description: 使用 NameRepository 来获取迭代器，并打印名字。
 * @author: ms
 * @create: 2022-10-27 16:31
 */
public class TestMain {

    public static void main(String[] args) {
        NameRepository namesRepository = new NameRepository();

//        for(Iterator iter = namesRepository.getIterator(); iter.hasNext();){
//            String name = (String)iter.next();
//            System.out.println("Name : " + name);
//        }

        Iterator iterator = namesRepository.getIterator();
        while (iterator.hasNext()){
            String name = (String)iterator.next();
            System.out.println("Name : " + name);
        }

    }
}